import time
from selenium import webdriver
from selenium.webdriver.common.by import By
driver=webdriver.Chrome()
# driver=webdriver.Firefox()
driver.get('http://101.133.169.100/yuns/index.php')
# time.sleep(3)
driver.maximize_window()#设置窗体最大化
size=driver.find_element(By.XPATH,"//div[@class='schbox']/form/input[1]").size#得到输入框的高和宽
print(size)
print(type(size))
print(size['width'])#通过字典类型取值
# text=driver.find_element_by_css_selector('div.schhot>a:nth-child(2)').text#使用css定位到a标签中的文本信息
# print(text)
# pla_vluew=driver.find_element_by_xpath("//div[@class='schbox']/form/input[1]").get_attribute('placeholder')#定位元素后通过属性名取属性值
# print(pla_vluew)
dis=driver.find_element_by_xpath("//div[@class='schbox']/form/input[@placeholder='请输入你要查找的关键字']").is_displayed()#判断标签元素是否被加载
print(dis)
#
if dis==True:
    driver.find_element_by_css_selector('div.schbox>form>input:nth-last-child(2)').send_keys('衣服1')
    value=driver.find_element(By.CSS_SELECTOR,'html>body>div>div>div>div>form>input:first-child').get_attribute('value')
    print(value)
    d
else:
    time.sleep(3)
    print('fdfd')
    driver.find_element_by_xpath("//div[@class='schbox']/form/*[1]").send_keys("衣服2")

# time.sleep(2)
driver.quit()